{% extends "../../layui/layouts/main.html" %}

{% block mainbody %}
<div id="menu-index">

    <script type="text/html" id="tool">
        {% verbatim %}
        <a class="layui-btn layui-btn-danger layui-btn-xs">查看</a>
        {% endverbatim %}
    </script>

    <div class="layui-card">
        <div class="layui-card-header yak-card-header">
            {{Header}}
        </div>
        <div class="layui-card-body">
            <table id="drug-table" lay-filter="drug-table-filter"></table>
        </div>
    </div>

</div>
{% endblock %}

{% block script %}
<script>
    layui.use(['grid', 'layarea', 'laydate'], function () {
        var pager = layui.grid
            , layarea = layui.layarea
            , laydate = layui.laydate
            , tableId = "drug-table"
            , laytpl = layui.laytpl
            , tableFilter = "drug-table-filter"
            , searchFilter = "drug-search"
            , cols = [
            {width: 60, field: "_serial", title: "序号"},
            {field: "number", title: "编号", event: "detail", style: "color:blue"},
            {field: "message", title: "反馈内容"},
            {field: "address", title: "所属区域"},
            // {fixed: 'right', width: 300, align: 'center', toolbar: '#tool'}
        ]
            , table = {
            "id": tableId,
            "elem": "#" + tableId,
            "limit": 8,
            "limits": [10, 20, 50, 100],
            "cols": [cols],
            "method": "post",
            "request": {"pageName": "page", "limitName": "per-page"},
            "url": "/discuss-detail",
            "defaultCondition": {"pid": {{pid}}},
            // "toolbar": "#toolBar",
            "page": {"hash": "fenye"},
            "autoSort": false,
            "defaultToolbar": []
        }
            , eventOptions = {
            "detail": {"url": "/discuss-detail/view", "open": "iframe", "openRefresh": true},
        },
            events = {}


    layarea.render({
        elem: '#' + searchFilter,
        change: function (res) {
            //选择结果
            console.log(res)
        }
    });

    laydate.render({
        elem: '#yak_dt_s'
    });

    laydate.render({
        elem: '#yak_dt_e'
    });

    pager.render({
        "searchFilter": searchFilter,
        "tableId": tableId,
        "tableFilter": tableFilter,
        "sort": "server",
        "countCache": true,
        "table": table,
        "editor": {},
        "eventOptions": eventOptions
    }, events)

    })
</script>
{% endblock %}